home *** CD-ROM | disk | FTP | other *** search
- .model large
-
- .code
- ; The stack frame looks like this:
- ;
- ; | flags | - foreground flags
- ; | segment | - foreground segment to return to
- ; | offset | - " offset " "
- ; | ax | - regs:
- ; | bx |
- ; | cx |
- ; | dx |
- ; | es |
- ; | ds |
- ; | si |
- ; | di |
- ; | bp |
- ; | ?????? | - local variables
- ; | new seg | - segment to chain to
- ; | new off | - offset " "
- ; | segment | - segment from call to _chain
- ; | offset | - offset from call to _chain
- ;
-
- chain_addr dd ? ; code segment variable for
- ; addr to chain to
-
- _chain proc
- pop cx ; discard segment to return to
- pop cx ; discard offset to return to
- pop word ptr cs:[chain_addr] ; save chain offset
- pop word ptr cs:[chain_addr+2] ; save chain segment
-
- mov sp, bp ; reset stack frame
- pop bp
- pop di
- pop si
- pop ds
- pop es
- pop dx
- pop cx
- pop bx
- pop ax
-
- jmp dword ptr cs:[chain_addr] ; chain to address
- _chain endp
-
- public _chain
-
- end
-